package com.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@EnableScheduling
@Component
@EnableAsync
public class Tasks {


    @Async("taskExecutor")
    @Scheduled(fixedDelay = 1000,cron = "0 18 15 * * ?")//时间间隔 指定时间开始
    public void timerTest() {
        System.out.println("thread1=============" );
    }
    @Async("taskExecutor")
    @Scheduled(fixedDelay = 1000,cron = "0 18 15 * * ?")//时间间隔 指定时间开始
    public void timerTest2() {
        System.out.println("thread2=============" );
    }
}

